home *** CD-ROM | disk | FTP | other *** search
Wrap
<refentry id="libgimp-gimpenv" revision="19 Jan 2001"> <refmeta> <refentrytitle>gimpenv</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBGIMP Library</refmiscinfo> </refmeta> <refnamediv> <refname>gimpenv</refname><refpurpose>Functions to access the GIMP environment.</refpurpose> </refnamediv> <refsynopsisdiv><title>Synopsis</title> <synopsis> <link linkend="gchar">gchar</link>* <link linkend="gimp-directory">gimp_directory</link> (void); <link linkend="gchar">gchar</link>* <link linkend="gimp-personal-rc-file">gimp_personal_rc_file</link> (<link linkend="gchar">gchar</link> *basename); <link linkend="gchar">gchar</link>* <link linkend="gimp-data-directory">gimp_data_directory</link> (void); <link linkend="gchar">gchar</link>* <link linkend="gimp-sysconf-directory">gimp_sysconf_directory</link> (void); <link linkend="gchar">gchar</link>* <link linkend="gimp-gtkrc">gimp_gtkrc</link> (void); <link linkend="GList">GList</link>* <link linkend="gimp-path-parse">gimp_path_parse</link> (<link linkend="gchar">gchar</link> *path, <link linkend="gint">gint</link> max_paths, <link linkend="gboolean">gboolean</link> check, <link linkend="GList">GList</link> **check_failed); void <link linkend="gimp-path-free">gimp_path_free</link> (<link linkend="GList">GList</link> *path); <link linkend="gchar">gchar</link>* <link linkend="gimp-path-to-str">gimp_path_to_str</link> (<link linkend="GList">GList</link> *path); <link linkend="gchar">gchar</link>* <link linkend="gimp-path-get-user-writable-dir">gimp_path_get_user_writable_dir</link> (<link linkend="GList">GList</link> *path); </synopsis> </refsynopsisdiv> <refsect1> <title>Description</title> <para> A set of functions to find the locations of GIMP's data directories and configuration files. </para> </refsect1> <refsect1> <title>Details</title> <refsect2> <title><anchor id="gimp-directory">gimp_directory ()</title> <programlisting><link linkend="gchar">gchar</link>* gimp_directory (void);</programlisting> <para> Returns the user-specific GIMP settings directory. If the environment variable GIMP_DIRECTORY exists, it is used. If it is an absolute path, it is used as is. If it is a relative path, it is taken to be a subdirectory of the home directory. If it is relative path, and no home directory can be determined, it is taken to be a subdirectory of <link linkend="gimp-data-directory">gimp_data_directory</link>(). </para> <para> The usual case is that no GIMP_DIRECTORY environment variable exists, and then we use the GIMPDIR subdirectory of the home directory. If no home directory exists, we use a per-user subdirectory of <link linkend="gimp-data-directory">gimp_data_directory</link>(). In any case, we always return some non-empty string, whether it corresponds to an existing directory or not. </para> <para> The returned string is allocated just once, and should *NOT* be freed with <link linkend="g-free">g_free</link>().</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The user-specific GIMP settings directory. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-personal-rc-file">gimp_personal_rc_file ()</title> <programlisting><link linkend="gchar">gchar</link>* gimp_personal_rc_file (<link linkend="gchar">gchar</link> *basename);</programlisting> <para> Returns the name of a file in the user-specific GIMP settings directory. </para> <para> The returned string is allocated dynamically and *SHOULD* be freed with <link linkend="g-free">g_free</link>() after use.</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>basename</parameter> :</entry> <entry> The basename of a rc_file. </entry></row> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The name of a file in the user-specific GIMP settings directory. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-data-directory">gimp_data_directory ()</title> <programlisting><link linkend="gchar">gchar</link>* gimp_data_directory (void);</programlisting> <para> Returns the top directory for GIMP data. If the environment variable GIMP_DATADIR exists, that is used. It should be an absolute pathname. Otherwise, on Unix the compile-time defined directory is used. On Win32, the installation directory as deduced from the executable's name is used. </para> <para> The returned string is allocated just once, and should *NOT* be freed with <link linkend="g-free">g_free</link>().</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The top directory for GIMP data. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-sysconf-directory">gimp_sysconf_directory ()</title> <programlisting><link linkend="gchar">gchar</link>* gimp_sysconf_directory (void);</programlisting> <para> Returns the top directory for GIMP config files. If the environment variable GIMP_SYSCONFDIR exists, that is used. It should be an absolute pathname. Otherwise, on Unix the compile-time defined directory is used. On Win32, the installation directory as deduced from the executable's name is used. </para> <para> The returned string is allocated just once, and should *NOT* be freed with <link linkend="g-free">g_free</link>().</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The top directory for GIMP config files. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-gtkrc">gimp_gtkrc ()</title> <programlisting><link linkend="gchar">gchar</link>* gimp_gtkrc (void);</programlisting> <para> Returns the name of the GIMP's application-specific gtkrc file. </para> <para> The returned string is allocated just once, and should *NOT* be freed with <link linkend="g-free">g_free</link>().</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The name of the GIMP's application-specific gtkrc file. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-path-parse">gimp_path_parse ()</title> <programlisting><link linkend="GList">GList</link>* gimp_path_parse (<link linkend="gchar">gchar</link> *path, <link linkend="gint">gint</link> max_paths, <link linkend="gboolean">gboolean</link> check, <link linkend="GList">GList</link> **check_failed);</programlisting> <para> </para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>path</parameter> :</entry> <entry> A list of directories separated by <link linkend="G-SEARCHPATH-SEPARATOR-CAPS">G_SEARCHPATH_SEPARATOR</link>. </entry></row> <row><entry align="right"><parameter>max_paths</parameter> :</entry> <entry> The maximum number of directories to return. </entry></row> <row><entry align="right"><parameter>check</parameter> :</entry> <entry> <link linkend="TRUE-CAPS">TRUE</link> if you want the directories to be checked. </entry></row> <row><entry align="right"><parameter>check_failed</parameter> :</entry> <entry> Returns a <link linkend="GList">GList</link> of path elements for which the check failed. Each list element is guaranteed to end with a <link linkend="G-PATH-SEPARATOR-CAPS">G_PATH_SEPARATOR</link>. </entry></row> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A <link linkend="GList">GList</link> of all directories in <parameter>path</parameter>. Each list element is guaranteed to end with a <link linkend="G-PATH-SEPARATOR-CAPS">G_PATH_SEPARATOR</link>. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-path-free">gimp_path_free ()</title> <programlisting>void gimp_path_free (<link linkend="GList">GList</link> *path);</programlisting> <para> This function frees the memory allocated for the list and it's strings.</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>path</parameter> :</entry> <entry> A list of directories as returned by <link linkend="gimp-path-parse">gimp_path_parse</link>(). </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-path-to-str">gimp_path_to_str ()</title> <programlisting><link linkend="gchar">gchar</link>* gimp_path_to_str (<link linkend="GList">GList</link> *path);</programlisting> <para> </para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>path</parameter> :</entry> <entry> A list of directories as returned by <link linkend="gimp-path-parse">gimp_path_parse</link>(). </entry></row> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A searchpath string separated by <link linkend="G-SEARCHPATH-SEPARATOR-CAPS">G_SEARCHPATH_SEPARATOR</link>. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-path-get-user-writable-dir">gimp_path_get_user_writable_dir ()</title> <programlisting><link linkend="gchar">gchar</link>* gimp_path_get_user_writable_dir (<link linkend="GList">GList</link> *path);</programlisting> <para> Note that you have to <link linkend="g-free">g_free</link>() the returned string.</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>path</parameter> :</entry> <entry> A list of directories as returned by <link linkend="gimp-path-parse">gimp_path_parse</link>(). </entry></row> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The first directory in <parameter>path</parameter> where the user has write permission. </entry></row> </tbody></tgroup></informaltable></refsect2> </refsect1> </refentry>